define(['angular', 'app.directives','services/common/base',], function (angular, directives) {
    'use strict';

    directives.directive("navigationLeft", ['$q','$location','$stateParams','$uibModal','CurrentUser', function ($q,$location,$stateParams,$uibModal,CurrentUser) {
        return {
            restrict: 'E',
            scope: {},
            replace: true,
            templateUrl: function () {
                return "/app/partial/basic/navigation_left.html";
            },
            link: function ($scope) {

                $(".s-left .s-l-box .s-l-nav ul li").hover(function(){
                    $(this).children().show("300");
                    $(this).siblings().find("ul").hide("200");
                });
                $scope.isShow=false;//是否显示
                if(CurrentUser.roleId=="0"){//管理员
                    $scope.isShow=true;
                }
            }
        }
    }]);
    directives.directive("navigationTop", ['$q','$location','$resource','$state','$stateParams','$uibModal','Base', function ($q,$location,$resource,$state,$stateParams,$uibModal,Base) {
        return {
            restrict: 'E',
            scope: {},
            replace: true,
            templateUrl: function () {
                return "/app/partial/basic/navigation_top.html";
            },
            link: function ($scope) {
                var error=function(error){
                    layer.msg(error.message, {
                        time: 2000, //1s后自动关闭ddl
                    });
                };
                /*$resource(Base.stringFormat("/cu", Base.dataApiUri.student)).get(function(data){
                    $scope.curUser=data.data;
                },error);*/
                //登出
                $scope.cuLogout=function(){
                    $resource(Base.stringFormat("/logout", Base.dataApiUri.student)).get(function(data){
                      //  $state.go("exam.student.quiz",{});
                       // window.open("/user/login/index");
                        window.location.href="/user/login/index";
                    },error);
                }


            }
        }
    }]);
    directives.directive("evaluationTj", ['$q','$location','$resource','$stateParams','$uibModal','Base', function ($q,$location,$resource,$stateParams,$uibModal,Base) {
        return {
            restrict: 'E',
            scope: {},
            replace: true,
            templateUrl: function () {
                return "/app/partial/basic/evaluation_tj.html";
            },
            link: function ($scope) {
                var error=function(error){
                    layer.msg(error.message, {
                        time: 2000, //1s后自动关闭ddl
                    });
                };
                $resource(Base.stringFormat("{0}/tjData", Base.dataApiUri.student)).get(function(data){
                    $scope.tjData=data.data;
                },error);
            }
        }
    }]);


});